package com.macro.mall.commission.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.macro.mall.commission.entity.OrderSettleEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 订单佣金结算 mapper
 *
 * @author xuyanjun
 * @date 2019-12-11
 */
public interface OrderSettleMapper extends BaseMapper<OrderSettleEntity> {

    /**
     * 批量修改结算到账状态
     *
     * @param ids                  ids
     * @param arrivedAccountStatus 到账状态
     * @return 受影响的行数
     */
    @Update({"<script>update commission_order_settle set arrived_status=#{arrivedAccountStatus},update_time=now() where id in",
            "<foreach collection=\"list\" item=\"item\" separator=\",\" open=\"(\" close=\");\">",
            "#{item}",
            "</foreach>",
            "</script>"
    })
    int updateArrivedStatus(@Param("list") List<Long> ids, @Param("arrivedAccountStatus") int arrivedAccountStatus);
}

